package com.beyond.pm.ui.main

import androidx.lifecycle.ViewModel
import com.beyond.common.manager.UserManager
import com.beyond.flow.container.Container
import com.beyond.flow.container.containers
import com.beyond.flow.inter.UiEvent
import com.beyond.flow.inter.UiState
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 * @author chen
 * @time 2023/6/1 12:42
 * @name ProjectManage
 * @class describe
 */
@HiltViewModel
class MainViewModel @Inject constructor() : ViewModel() {
    private val _container by containers<MainUiState, UiEvent>(MainUiState())
    val container: Container<MainUiState, UiEvent> = _container

    init {
        _container.updateState {
            copy(
                isLogin = !UserManager.user?.token.isNullOrEmpty()
            )
        }
    }
}

data class MainUiState(
    // 是否已经登录了
    val isLogin: Boolean = false,
) : UiState

